﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DbSharp.Framework.Storage.IO;
using DbSharp.Framework.TestEngine;
using DbSharp.Framework.CaseFile;
using DbSharp.Framework.Driver;

namespace DbSharp.Framework.Storage.XmlStorage
{

    public class XmlStorageFactory : IStorageFactory
    {
        public virtual IRecordsetStorage NewRcdSetStorage(ResultsetSection rsSection, ITestDataSource dbTestPlugin)
        {
            OutputSettingAttribute settingAttr;
            Dictionary<string, string> listFieldOutputName;     
            Dictionary<string, string> listFieldNullPlaceHolder ;

            StorageFactoryHelper.GetResultsetOutputSetting(rsSection, out settingAttr, out listFieldOutputName, out listFieldNullPlaceHolder);
            var storage = new XmlRecordsetStorage(dbTestPlugin, settingAttr, listFieldOutputName, listFieldNullPlaceHolder);
 
            return storage;
        }

        public virtual IScalarStorage NewScalarStorage(ResultsetSection rsSection, ITestDataSource dbTestPlugin)
        {
            OutputSettingAttribute settingAttr;
            Dictionary<string, string> listFieldOutputName;
            Dictionary<string, string> listFieldNullPlaceHolder;

            StorageFactoryHelper.GetResultsetOutputSetting(rsSection, out settingAttr, out listFieldOutputName, out listFieldNullPlaceHolder);
            var storage = new XmlScalarStorage(dbTestPlugin, settingAttr);
            return storage;
        }

        
    }

}
